﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HttpTest
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }


        public void showText(string ctx)
        {
            textBox1.Text = ctx;
            string jpeg = Utils.fetchjpeg(ctx);
            if (jpeg != null)
            {
                //MemoryStream stream = new MemoryStream();
                //byte[] byteArray = System.Text.Encoding.Default.GetBytes(jpeg);
                //stream.Write(byteArray, 0, byteArray.Length);
                Bitmap bmp = Utils.Base64StringToImage(jpeg);
                if (bmp!=null)
                {
                    new Form3() { BackgroundImage = new Bitmap(bmp) }.Show();
                }
                
                //stream.Close();
            }
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }
    }
}
